//
//  Team9SubjectOtherTableViewCell.m
//  Team9Project
//
//  Created by dllo on 15/10/19.
//  Copyright © 2015年 apple. All rights reserved.
//

#import "Team9SubjectOtherTableViewCell.h"
#import <Masonry.h>

#define WID 375.0
//#define HEI 667.0

@implementation Team9SubjectOtherTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView{
    self.cover_picImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.cover_picImageView];
    
    self.author_faceImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.author_faceImageView];
    self.author_faceImageView.layer.cornerRadius = 20 / WID * WIDTH;
    self.author_faceImageView.layer.masksToBounds = YES;
    
    self.titleLabel = [[Team9BaseLabel alloc] initWith:LableColorTypeOrangeGreen];
    [self.contentView addSubview:self.titleLabel];
    self.titleLabel.font = [UIFont systemFontOfSize:14 / WID * WIDTH];
    self.titleLabel.numberOfLines = 0;
//    self.titleLabel.textColor = [UIColor orangeColor];
    [self.titleLabel sizeToFit];
    
    self.title_subLabel = [[Team9BaseLabel alloc] init];
    [self.contentView addSubview:self.title_subLabel];
    self.title_subLabel.numberOfLines = 0;
    self.title_subLabel.font = [UIFont systemFontOfSize:14 / WID * WIDTH];
    [self.title_subLabel sizeToFit];
    
    self.work_design_priceLabel = [[Team9BaseLabel alloc] init];
    [self.contentView addSubview:self.work_design_priceLabel];
    self.work_design_priceLabel.font = [UIFont systemFontOfSize:14 / WID * WIDTH];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    [self.cover_picImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(self.contentView.mas_left).offset(10 / WID * WIDTH);
        make.right.equalTo(self.contentView.mas_right).offset(-10 / WID * WIDTH);
        make.height.equalTo(@(200 / WID * WIDTH));
    }];
    
    [self.author_faceImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.cover_picImageView);
        make.width.height.equalTo(@(40 / WID * WIDTH));
        make.top.equalTo(self.cover_picImageView.mas_bottom).offset(10 / WID * WIDTH);
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.author_faceImageView.mas_right).offset(10 / WID * WIDTH);
        make.top.equalTo(self.author_faceImageView);
        make.right.equalTo(self.cover_picImageView);
    }];
    
    [self.title_subLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.height.equalTo(self.titleLabel);
        make.top.equalTo(self.titleLabel.mas_bottom).offset(5 / WID * WIDTH);
    }];
}


@end
